#include "tsa_fsm.h"

typedef enum
{
    EG_EVENT_TASK = 0,
    EG_EVENT_TURN_OFF,
    EG_EVENT_TURN_ON,

    EG_EVENT_MAX
}
EG_EVENT;

typedef enum
{
    EG_STATE_INIT = 0,
    EG_STATE_OFF,
    EG_STATE_ON,

    EG_STATE_MAX,
}
EG_STATE;

const TSA_FSM_TRANSITION_TABLE eg_transFromState[EG_STATE_MAX] = 
{
                /// task                off                     on
/* init */  {   {EG_STATE_OFF, NULL},   {EG_STATE_INIT, NULL}， {EG_STATE_INIT, NULL}   },
/* off  */  {   {EG_STATE_OFF, NULL},   {EG_STATE_OFF, NULL},   {EG_STATE_ON, NULL}     },
/* on   */  {   {EG_STATE_ON,  NULL},   {EG_STATE_OFF, NULL},   {EG_STATE_ON, NULL}     },
};

const TSA_FSM_OPERATION_LIST eg_action[EG_STATE_MAX] = 
{
    /// enter   run         exit
    {NULL,      NULL,       NULL}, /// init
    {turnOff,   NULL,       NULL}, /// off
    {turnOn,    NULL,       NULL}, /// on
};

const TSA_FSM_CONFIG_STRUCT eg_config = 
{
    EG_STATE_INIT,      // default state
    EG_STATE_MAX,       // total state number
    EG_EVENT_MAX,       // total event number
    eg_action,          // action table
    eg_transFromState,  // transition table
};

